package hd3.wordcount;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.WritableComparator;

/**
 * @Author: laoyu
 * @Date: 2020/6/4 12:24
 * @Description:
 */
public class WcIntWritableComparator extends IntWritable.Comparator {

    public int compare(WritableComparator a, WritableComparator b) {
        //比较结果取负数，即可降序
        return -super.compare(a, b);
    }

    @Override
    public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
        return -super.compare(b1, s1, l1, b2, s2, l2);
    }
}
